export function getFileCache(filePath, fileName, fileType) {
    //  缓存key值 
    let storageKey = 'FILE_CACHE_INFO_' + fileName + fileType
    const cacheFileInfo = uni.getStorageSync(storageKey)
    if (cacheFileInfo) {
        console.log("已缓存为：" + cacheFileInfo)
        return cacheFileInfo
    } else {
        console.log("未缓存,进行下载保存")
        // 如果没有，执行下载，并存储起来后
        uni.downloadFile({
            url: filePath,
            success: (res) => {
                if (res.statusCode === 200) {
                    console.log('下载成功');
                    // 再进行本地保存
                    uni.saveFile({
                        tempFilePath: res.tempFilePath,
                        success: function (res2) {
                            console.log(res2.savedFilePath)
                            uni.setStorageSync(storageKey, res2.savedFilePath)
                            return res2.savedFilePath
                        },
                        fail: function (res2) {
                            return filePath
                        }
                    })
                } else {
                    console.log('下载临时文件失败')
                    return filePath
                }
            },
            fail: (res) => {
                console.log(res)
                return filePath
            }
        })
    }

}